/**
 * 游戏规则类
 */
public class GuessGame {
    private Computer computer = new Computer();
    private Player player = new Player();

    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println("第"+(i+1)+"局");
            int computerNumber = computer.generatNumbers();
            int playerNumber = player.generatNumbers();
            //0石头，1剪刀，2布
            if (computerNumber == playerNumber) {
                System.out.println("电脑出的是："+computerNumber);
                System.out.println("平局,加1分");
                player.grades += 1;
            } else if (computerNumber == 0 && playerNumber == 2 || computerNumber == 1 && playerNumber == 0 || computerNumber == 2 && playerNumber == 1) {
                System.out.println("电脑出的是："+computerNumber);
                System.out.println("你赢了,加3分");
                player.grades += 3;
            } else {
                System.out.println("电脑出的是："+computerNumber);
                System.out.println("你输了,扣两分");
                player.grades -= 2;
            }
        }
        System.out.println("你获得了"+player.grades+"分");
        if (player.grades>=10){
            System.out.println("恭喜你赢了");
        }else if (player.grades<0){
            System.out.println("垃圾");
        }else {
            System.out.println("一般般啦");
        }
    }
}
